

\documentclass{article}
\usepackage[landscape, top=1.5in, bottom=1in, right=.5in, left=.5in]{geometry}
\usepackage{dcolumn}
\begin{document}

Read in and replace missing data
<<>>=
require(knitr)
library(car)
library(stargazer)
library(MASS)
library(ggplot2)
setwd("~/Desktop/Dropbox/School/THESIS/Thesis Data")
m.full <- read.csv("mturkdata.csv", header=TRUE)
m.full$rate_hard <- recode(m.full$rate_hard, "NA=99")
m.full$rate_soft <- recode(m.full$rate_soft, "NA=99")
m.full$knowledge_hard <- recode(m.full$knowledge_hard, "NA=99")
m.full$knowledge_soft <- recode(m.full$knowledge_soft, "NA=99")
@
Create full dataset, additional variables, adiitional datasets that subset for age, and an additional dataset that displays those who got the control treatment.
<<>>=
mturk <- subset(m.full, completion==1 & citizenship==1 & consent==1)
mturk$female <- mturk$gender
mturk$white <- recode(mturk$race, "2:5=0")
mturk$hardnews <- ifelse(mturk$rate_hard!=99, 1, 0) #received hard treatment
mturk$softnews <- ifelse(mturk$rate_soft!=99, 1, 0) #received soft treatment
mturk$control <- ifelse(mturk$rate_soft==99 & mturk$rate_hard==99, 1, 0)

mturk$hardsoft <- ifelse(mturk$rate_soft!=99, 1, 
                              ifelse(mturk$rate_hard!=99, 0, NA))

mturk$treatment <- ifelse(mturk$rate_hard!=99, "Hard", 
                              ifelse(mturk$rate_soft!=99, "Soft", "Control"))
mturk$treatment <- as.factor(mturk$treatment)
mturk$knowledge_soft <- ifelse(mturk$knowledge_soft==2, 1, 0)
mturk$knowledge_hard <- ifelse(mturk$knowledge_hard==2, 1, 0)

#Additive index for Dem. Party evaluation (7-28 scale)
mturk$d_eval <- (mturk$dem_care + mturk$dem_honest + mturk$dem_inspiring 
                     + mturk$dem_knowledgeable + mturk$dem_decisive + 
                       mturk$dem_leader + mturk$dem_competent)

#Additive index for Rep. Party evaulation (7-28 scale)
mturk$r_eval <- (mturk$rep_care + mturk$rep_honest + mturk$rep_inspiring
                     + mturk$rep_knowledgeable + mturk$rep_decisive 
                     + mturk$rep_leader + mturk$rep_competent)

# Overall Party evaluation additive index (14-56 scale)
mturk$overall_eval <- (mturk$d_eval + mturk$r_eval)

# Party Intensity (PID folded)
mturk$intensity <- ifelse(mturk$party_id==1 | mturk$party_id==5, 3, 
                              ifelse(mturk$party_id==3, 1, 2))

#regular viewers of Daily Show
mturk$reg_tds <- ifelse(mturk$source_tds==4 | mturk$source_tds==3, 1, 0)

#convert variables to factors
mturk$systemtrust <- as.factor(mturk$systemtrust)
mturk$mediatrust <- as.factor(mturk$mediatrust)
mturk$mediacoverage <- as.factor(mturk$mediacoverage)
mturk$efficacy <- as.factor(mturk$efficacy)

#variable for enjoyment (movement from hard to soft)
mturk$enjoy[mturk$treatment=="Soft"] <- mturk$rate_soft[mturk$treatment=="Soft"]
mturk$enjoy[mturk$treatment=="Hard"] <- mturk$rate_hard[mturk$treatment=="Hard"]
mturk$enjoy <- as.factor(mturk$enjoy)
summary(mturk$enjoy)

#variable for knowledge (movement from hard to soft)
mturk$knowledge[mturk$treatment=="Soft"] <- mturk$knowledge_soft[mturk$treatment=="Soft"]
mturk$knowledge[mturk$treatment=="Hard"] <- mturk$knowledge_hard[mturk$treatment=="Hard"]
mturk$knowledge <- as.factor(mturk$knowledge)
summary(mturk$knowledge)

#Subset of respondents who are 29 or younger
mturk.29 <- subset(mturk, age<=29)

#Subset of respondents who are 24 or younger
mturk.24 <- subset(mturk, age<=24)

#subset of respondents who got control treatment
mturk.control <- subset(mturk, treatment=="Control")

#subset of regular TDS viewers
mturk.reg <- subset(mturk, reg_tds==1)
mturk.reg29 <- subset(mturk.29, reg_tds==1)
mturk.reg24 <- subset(mturk.24, reg_tds==1)

#subset of non-TDS viewers
mturk.non <- subset(mturk, reg_tds==0)
mturk.non29 <- subset(mturk.29, reg_tds==0)
mturk.non24 <- subset(mturk.24, reg_tds==0)
@
Manipulation check
<<>>=

t.test(mturk$rate_soft[mturk$treatment=="Soft"], 
       mturk$rate_hard[mturk$treatment=="Hard"])


enj1 <- polr(enjoy ~ hardsoft + race + female + party_id + intensity,
               method=c("probit"), data=mturk)
summary(enj1)

@
Knowledge check (recognition)
<<>>=
t.test(mturk$knowledge_hard[mturk$treatment=="Hard"],
       mturk$knowledge_soft[mturk$treatment=="Soft"])


@
Lm tests for party evaluations (based off of Baumgartner and Morris) - full dataset
<<>>=
eval1 <- lm(r_eval ~ treatment + white + female + party_id + intensity, data=mturk)
eval2 <- lm(d_eval ~ treatment + white + female + party_id + intensity, data=mturk)
eval3 <- lm(overall_eval ~ treatment + white + female + party_id + intensity, 
            data=mturk)
@
<<results='asis'>>=
stargazer(eval1, eval2, eval3, 
          title="Party Evaluations by Experimental Condition 
          (Based on Baumgartner Model)", 
          no.space=TRUE, 
          dep.var.labels=c("Republican Party Evaluation", "Democratic Party Evaluation",
                           "Overall Party Evaluation"), 
          covariate.labels=c("The Daily Show condition", "CBS News condition", 
                             "Race", "Female", "Republican", 
                             "Intensity"), 
          single.row=TRUE, 
          model.numbers=FALSE, 
          order=c(2, 1, 3, 4, 5, 6),
          apply.p=function(x){x/2},
          notes=c("(One-tailed test)", "Republican (1=strong Dem. to 5=Strong Rep.)",
                  "Race (1=White, 0=non-White)","Intensity (PID folded)"),
          notes.align="r",
          align=TRUE,
          omit.stat=c("f", "rsq", "ser"))
@

Lm test for party evaluations with additional controls (age and education) - full dataset
<<>>=
eval10 <- lm(r_eval ~ treatment + white + female + party_id + intensity + age 
             + education, data=mturk)
eval11 <- lm(d_eval ~ treatment + white + female + party_id + intensity + age 
             + education, data=mturk)
eval12 <- lm(overall_eval ~ treatment + white + female + party_id + intensity + age 
             +education, data=mturk)
@
<<results='asis'>>=
stargazer(eval10, eval11, eval12, 
          title="Party Evaluations by Experimental Condition with Additional Controls", 
          no.space=TRUE, 
          dep.var.labels=c("Republican Party Evaluation", "Democratic Party Evaluation",
                           "Overall Party Evaluation"), 
          covariate.labels=c("The Daily Show condition", "CBS News condition", 
                             "Race", "Female", 
                             "Republican", "Party Intensity", "Age", "Education"), 
          single.row=TRUE, 
          model.numbers=FALSE, 
          order=c(2, 1, 3, 4, 5, 6, 7, 8),
          apply.p=function(x){x/2},
          notes=c("(One-tailed test)","Republican 
                  (1=strong Dem. to 5=Strong Rep.)","Race (1=White, 0=non-White)",
                  "Intensity (PID folded)"),
          notes.align="r",
          align=TRUE,
          omit.stat=c("f", "rsq", "ser"))
@

Tests on political efficacy (Baumgartner Method) - full dataset
<<>>=
trust1 <- polr(systemtrust ~ treatment + race + female + party_id + intensity,
               method=c("probit"), data=mturk)
mt1 <- polr(mediatrust ~ treatment + race + female + party_id + intensity, 
            method=c("probit"), data=mturk)
mc1 <- polr(mediacoverage ~ treatment + race + female + party_id + intensity,
            method=c("probit"), data=mturk)
eff1 <- polr(efficacy ~ treatment + race + female + party_id + intensity,
            method=c("probit"), data=mturk)
@
<<results='asis'>>=
stargazer(trust1, mt1, mc1, eff1,
          title=c("Perceptions of Electoral System, and Media by Experimental Condition
                  (Based on Baumgartner Model)"),
          no.space=TRUE,
          order=c(2, 1, 3, 4, 5, 6),
          dep.var.labels=c("Faith in
                          Electoral System", "Trust in
                          News Media", "
                          Political Coverage", "Efficacy"),
          covariate.labels=c("The Daily Show Condition", "CBS News Condition",
                             "Race", "Female", "Republican", "Intensity"),
          single.row=TRUE,
          model.numbers=FALSE,
          apply.p=function(x){x/2},
          notes=c("(One-tailed test)","Republican 
                  (1=strong Dem. to 5=Strong Rep.)","Race (1=White, 0=non-White)",
                  "Intensity (PID folded)"),
          notes.align="r",
          align=TRUE,
          column.sep.width=c("-10pt"))
@

Tests on efficacy with additional controls (age and education) - full dataset
<<>>=
trust4 <- polr(systemtrust ~ treatment + race + female + party_id + intensity + age
               + education, method=c("probit"), data=mturk)
mt4 <- polr(mediatrust ~ treatment + race + female + party_id + intensity + age
            + education, method=c("probit"), data=mturk)
mc4 <- polr(mediacoverage ~ treatment + race + female + party_id + intensity + age
            + education, method=c("probit"), data=mturk)
eff4 <- polr(efficacy ~ treatment + race + female + party_id + intensity + age
             + education, method=c("probit"), data=mturk)
@
<<results='asis'>>=
stargazer(trust4, mt4, mc4, eff4,
          title=c("Perceptions of Electoral System, Media, and Internal Efficacy by
                  Experimental Condition with Additional Controls"),
          no.space=TRUE,
          order=c(2, 1, 3, 4, 5, 6),
          dep.var.labels=c("Faith in
                          Electoral System", "Trust in
                          News Media", "
                          Political Coverage", "Efficacy"),
          covariate.labels=c("The Daily Show Condition", "CBS News Condition",
                             "Race", "Female", "Repbulican", "Intensity",
                             "Age", "Education"),
          single.row=TRUE,
          model.numbers=FALSE,
          apply.p=function(x){x/2},
          notes=c("(One-tailed test)", "Republican 
                  (1=strong Dem. to 5=Strong Rep.)","Race (1=White, 0=non-White)",
                  "Intensity (PID folded)"),
          notes.align="r",
          align=TRUE,
          column.sep.width=c("-10pt"))
@

Candidate Evaluations between regular TDS viewers and non-viewers
<<>>=
eval19 <- lm(r_eval~treatment + race + female + party_id + intensity, 
             data=mturk.reg)
eval20 <- lm(r_eval~treatment + race + female + party_id + intensity, 
             data=mturk.non)
eval21 <- lm(d_eval~treatment + race + female + party_id + intensity, 
             data=mturk.reg)
eval22 <- lm(d_eval~treatment + race + female + party_id + intensity, 
             data=mturk.non)
eval23 <- lm(overall_eval~treatment + race + female + party_id + intensity, 
             data=mturk.reg)
eval24 <- lm(overall_eval~treatment + race + female + party_id + intensity, 
             data=mturk.non)
@
<<results='asis'>>=
stargazer(eval20, eval19, eval22, eval21, eval24, eval23,
          title="Candidate Evaluations by Experimental Condition, Viewer and Non-viewer",
          covariate.labels=c("The Daily Show condition", "CBS News conditions", "Race",
                           "Female", "Republican", "Party Intensity"),
          dep.var.labels=c("Republican Eval.",  "Democratic Eval.", "Overall Eval."),
          column.labels=c("Non-viewer", "Viewer", "Non-viewer", "Viewer", 
                          "Non-viewer", "Viewer"),
          column.separate=c(1,1,1,1,1,1),
          order=c(2, 1, 3, 4, 5, 6),
          model.numbers=FALSE,
          apply.p=function(x){x/2},
          notes=c("(One-tailed test)","Republican 
                  (1=strong Dem. to 5=Strong Rep.)","Race (1=White, 0=non-White)",
                  "Intensity (PID folded)"),
          notes.align="r",
          align=TRUE,
          omit.stat=c("f", "rsq", "ser"),
          column.sep.width=c("5pt"))
@

Efficacy tests between regular TDS viewers and non-viewers
<<>>=
trust7 <- polr(systemtrust ~ treatment + race + female + party_id + intensity,
               method=c("probit"), data=mturk.non)
trust8 <- polr(systemtrust ~ treatment + race + female + party_id + intensity,
               method=c("probit"), data=mturk.reg)
mt7 <- polr(mediatrust ~ treatment + race + female + party_id + intensity,
               method=c("probit"), data=mturk.non)
mt8 <- polr(mediatrust ~ treatment + race + female + party_id + intensity,
               method=c("probit"), data=mturk.reg)
mc7 <- polr(mediacoverage ~ treatment + race + female + party_id + intensity,
               method=c("probit"), data=mturk.non)
mc8 <- polr(mediacoverage ~ treatment + race + female + party_id + intensity,
               method=c("probit"), data=mturk.reg)
eff7 <- polr(efficacy ~ treatment + race + female + party_id + intensity,
               method=c("probit"), data=mturk.non)
eff8 <- polr(efficacy ~ treatment + race + female + party_id + intensity,
               method=c("probit"), data=mturk.reg)
@
<<results='asis'>>=
stargazer(trust7, trust8, mt7, mt8, mc7, mc8, eff7, eff8,
          title=c("Perceptions of Electoral System, Media, and Internal Efficacy
                  by Experimental Condition, Viewer and Non-viewer"),
          covariate.labels=c("The Daily Show condition", "CBS News conditions", "Race",
                           "Female", "Republican", "Party Intensity"),
          dep.var.labels=c("Faith in
                          Electoral System", "Trust in
                          News Media", "
                          Political Coverage", "Efficacy"),
          column.labels=c("Non-viewer", "Viewer", "Non-viewer", "Viewer", 
                          "Non-viewer", "Viewer", "Non-viewer", "Viewer"),
          column.separate=c(1,1,1,1,1,1,1,1),
          order=c(2, 1, 3, 4, 5, 6),
          model.numbers=FALSE,
          apply.p=function(x){x/2},
          notes=c("(One-tailed test)","Republican 
                  (1=strong Dem. to 5=Strong Rep.)","Race (1=White, 0=non-White)",
                  "Intensity (PID folded)"),
          notes.align="r",
          align=TRUE,
          omit.stat=c("f", "rsq", "ser"),
          column.sep.width=c("5pt"),
          font.size="small")
@


Candidate evaluation based on media exposure (control group) - full control dataset
<<>>=
c1 <- lm(r_eval ~ source_latenight + source_tds + source_orf + source_lwt + 
           source_netnews + source_localnews + source_newspaper + race + 
           female + party_id, data=mturk.control)
c2 <- lm(d_eval ~ source_latenight + source_tds + source_orf + source_lwt + 
           source_netnews + source_localnews + source_newspaper + race + 
           female + party_id, data=mturk.control)
c3 <- lm(overall_eval ~ source_latenight + source_tds + source_orf + source_lwt + 
           source_netnews + source_localnews + source_newspaper + race + 
           female + party_id, data=mturk.control)
@
<<results='asis'>>=
stargazer(c1, c2, c3,
          title=c("Candidate Evaluations by Media Exposure (control group only)"),
          no.space=TRUE,
          dep.var.labels=c("Republican Eval.", "Democratic Eval.",
                            "Overall Eval."),
          covariate.labels=c("Fallon and/or Kimmel", "The Daily Show", 
                             "The O'Reilly Factor", "Last Week Tonight",
                             "Network evening news", "Local evening news", 
                             "Daily newspaper", "White", "Female", "Repbulican"),
          single.row=TRUE,
          model.numbers=FALSE,
          apply.p=function(x){x/2},
          notes=c("(One-tailed test)","Republican 
                  (1=strong Dem. to 5=Strong Rep.)","Race (1=White, 0=non-White)",
                  "Intensity (PID folded)"),
          notes.align="r",
          align=TRUE,
          column.sep.width=c("-10pt"),
          omit.stat=c("f", "rsq", "ser"))
@
Efficacy evaluations based on media exposure (control group) - full control dataset
<<>>=
c4 <- polr(systemtrust ~ source_latenight + source_tds + source_orf + source_lwt + 
           source_netnews + source_localnews + source_newspaper + race + 
           female + party_id, method=c("probit"), data=mturk.control)
c5 <- polr(mediatrust ~ source_latenight + source_tds + source_orf + source_lwt + 
           source_netnews + source_localnews + source_newspaper + race + 
           female + party_id, method=c("probit"), data=mturk.control)
c6 <- polr(mediacoverage ~ source_latenight + source_tds + source_orf + source_lwt + 
           source_netnews + source_localnews + source_newspaper + race + 
           female + party_id, method=c("probit"), data=mturk.control)
c7 <- polr(efficacy ~ source_latenight + source_tds + source_orf + source_lwt + 
           source_netnews + source_localnews + source_newspaper + race + 
           female + party_id, method=c("probit"), data=mturk.control)
@
<<results='asis'>>=
stargazer(c4, c5, c6, c7,
          title=c("Perceptions of Electoral System, Media, and Internal Efficacy
                  by Media Exposure (control group only)"),
          no.space=TRUE,
          dep.var.labels=c("Faith in
                          Electoral System", "Trust in
                          News Media", "
                          Political Coverage", "Efficacy"),
          covariate.labels=c("Fallon and/or Kimmel", "The Daily Show", 
                             "The O'Reilly Factor", "Last Week Tonight",
                             "Network evening news", "Local evening news", 
                             "Daily newspaper", "White", "Female", "Repbulican"),
          single.row=TRUE,
          model.numbers=FALSE,
          apply.p=function(x){x/2},
          notes=c("(One-tailed test)","Republican 
                  (1=strong Dem. to 5=Strong Rep.)","Race (1=White, 0=non-White)",
                  "Intensity (PID folded)"),
          notes.align="r",
          align=TRUE,
          column.sep.width=c("10pt"))
@


\end{document}